package com.rm.freedrawsample;

import ohos.agp.utils.Color;
import ohos.app.Context;


/**
 * Created by Riccardo on 30/05/2017.
 *
 * @author author
 * @version version
 */
public class ColorHelper {
    /**
     * getRandomMaterialColor .
     *
     * @param context context
     * @return int
     */
    public static int getRandomMaterialColor(Context context) {
        String[] colors = context.getStringArray(ResourceTable.Strarray_material_colors);
        if (colors == null || colors.length == 0) {
            colors = new String[]{"#000000"};
        }
        int index = (int) (Math.random() * colors.length);
        String color = colors[index];
        return Color.getIntColor(color);
    }
}
